<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Classes  Reference</title>
    <link rel="stylesheet" type="text/css" href="css/jazzy.css" />
    <link rel="stylesheet" type="text/css" href="css/highlight.css" />
    <meta charset='utf-8'>
    <script src="js/jquery.min.js" defer></script>
    <script src="js/jazzy.js" defer></script>
    
  </head>
  <body>
    <a name="//apple_ref/swift/Section/Classes" class="dashAnchor"></a>
    <a title="Classes  Reference"></a>
    <header>
      <div class="content-wrapper">
        <p><a href="index.html">SwiftTerm 1.0 Docs</a> (65% documented)</p>
        <p class="header-right"><a href="https://github.com/migueldeicaza/SwiftTerm"><img src="img/gh.png"/>View on GitHub</a></p>
        <p class="header-right"><a href="dash-feed://https%3A%2F%2Fmigueldeicaza%2Egithub%2Eio%2FSwiftTerm%2Fdocsets%2FSwiftTerm%2Exml"><img src="img/dash.png"/>Install in Dash</a></p>
      </div>
    </header>
    <div class="content-wrapper">
      <p id="breadcrumbs">
        <a href="index.html">SwiftTerm Reference</a>
        <img id="carat" src="img/carat.png" />
        Classes  Reference
      </p>
    </div>
    <div class="content-wrapper">
      <nav class="sidebar">
        <ul class="nav-groups">
          <li class="nav-group-name">
            <a href="Classes.html">Classes</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Classes/Color.html">Color</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/HeadlessTerminal.html">HeadlessTerminal</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/LocalProcess.html">LocalProcess</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/LocalProcessTerminalView.html">LocalProcessTerminalView</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/PseudoTerminalHelpers.html">PseudoTerminalHelpers</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/Terminal.html">Terminal</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/Terminal/MouseMode.html">– MouseMode</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/Terminal/WindowManipulationCommand.html">– WindowManipulationCommand</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/TerminalAccessory.html">TerminalAccessory</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/TerminalDebugView.html">TerminalDebugView</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/TerminalView.html">TerminalView</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/TerminalView/Font.html">– Font</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/TerminalView.html">TerminalView</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/TerminalView/Font.html">– Font</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="Enums.html">Enumerations</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Enums/CursorStyle.html">CursorStyle</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="Extensions.html">Extensions</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Extensions/TerminalViewDelegate.html">TerminalViewDelegate</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="Protocols.html">Protocols</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Protocols/LocalProcessDelegate.html">LocalProcessDelegate</a>
              </li>
              <li class="nav-group-task">
                <a href="Protocols/LocalProcessTerminalViewDelegate.html">LocalProcessTerminalViewDelegate</a>
              </li>
              <li class="nav-group-task">
                <a href="Protocols/TerminalDelegate.html">TerminalDelegate</a>
              </li>
              <li class="nav-group-task">
                <a href="Protocols/TerminalViewDelegate.html">TerminalViewDelegate</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="Structs.html">Structures</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Structs/Attribute.html">Attribute</a>
              </li>
              <li class="nav-group-task">
                <a href="Structs/Attribute/Color.html">– Color</a>
              </li>
              <li class="nav-group-task">
                <a href="Structs/CharData.html">CharData</a>
              </li>
              <li class="nav-group-task">
                <a href="Structs/CharacterStyle.html">CharacterStyle</a>
              </li>
              <li class="nav-group-task">
                <a href="Structs/TerminalOptions.html">TerminalOptions</a>
              </li>
              <li class="nav-group-task">
                <a href="Structs/TinyAtom.html">TinyAtom</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="Typealiases.html">Type Aliases</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Typealiases.html#/s:9SwiftTerm7TTImagea">TTImage</a>
              </li>
            </ul>
          </li>
        </ul>
      </nav>
      <article class="main-content">
        <section>
          <section class="section">
            <h1>Classes</h1>
            <p>The following classes are available globally.</p>

          </section>
          <section class="section task-group-section">
            <div class="task-group">
              <ul>
                <li class="item">
                  <div>
                    <code>
                    <a name="/c:@M@SwiftTerm@objc(cs)TerminalView"></a>
                    <a name="//apple_ref/swift/Class/TerminalView" class="dashAnchor"></a>
                    <a class="token" href="#/c:@M@SwiftTerm@objc(cs)TerminalView">TerminalView</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>TerminalView provides an AppKit front-end to the <code><a href="Classes/Terminal.html">Terminal</a></code> termininal emulator.
 It is up to a subclass to either wire the terminal emulator to a remote terminal
 via some socket, to an application that wants to run with terminal emulation, or
 wiring this up to a pseudo-terminal.</p>

<p>Users are notified of interesting events in their implementation of the <code><a href="Protocols/TerminalViewDelegate.html">TerminalViewDelegate</a></code>
 methods - an instance must be provided to the constructor of <code>TerminalView</code>.</p>

<p>Developers might want to surface UIs for <code>optionAsMetaKey</code> and <code>allowMouseReporting</code> in
 their application.  They both default to true, but this means that Option-Letter is hijacked for
 terminal purposes to send the sequence ESC-Letter, instead of the macOS specific character` and
 means that when mouse-aware applications are running, they hijack the normal selection process.</p>

<p>Call the <code>getTerminal</code> method to get a reference to the underlying <code><a href="Classes/Terminal.html">Terminal</a></code> that backs this
 view.</p>

<p>Use the <code>configureNativeColors()</code> to set the defaults colors for the view to match the OS
 defaults, otherwise, this uses its own set of defaults colors.</p>

                        <a href="Classes/TerminalView.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">open</span> <span class="kd">class</span> <span class="kt">TerminalView</span> <span class="p">:</span> <span class="kt">NSView</span><span class="p">,</span> <span class="kt">NSTextInputClient</span><span class="p">,</span> <span class="kt">NSUserInterfaceValidations</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">TerminalView</span><span class="p">:</span> <span class="kt"><a href="Protocols/TerminalDelegate.html">TerminalDelegate</a></span></code></pre>

                        </div>
                      </div>
                      <div class="slightly-smaller">
                        <a href="https://github.com/migueldeicaza/SwiftTerm/tree/master/Sources/SwiftTerm/Mac/MacTerminalView.swift#L38-L982">Show on GitHub</a>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:9SwiftTerm5ColorC"></a>
                    <a name="//apple_ref/swift/Class/Color" class="dashAnchor"></a>
                    <a class="token" href="#/s:9SwiftTerm5ColorC">Color</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>This represents the colors used in SwiftTerm, in particular for cells and backgrounds
in 16-bit RGB mode</p>

                        <a href="Classes/Color.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">Color</span> <span class="p">:</span> <span class="kt">Hashable</span></code></pre>

                        </div>
                      </div>
                      <div class="slightly-smaller">
                        <a href="https://github.com/migueldeicaza/SwiftTerm/tree/master/Sources/SwiftTerm/Colors.swift#L15-L320">Show on GitHub</a>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:9SwiftTerm16HeadlessTerminalC"></a>
                    <a name="//apple_ref/swift/Class/HeadlessTerminal" class="dashAnchor"></a>
                    <a class="token" href="#/s:9SwiftTerm16HeadlessTerminalC">HeadlessTerminal</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>A <code>HeadlessTerminal</code> provides a terminal emulator that runs a local process, but the output does not go
anywhere.   You can use this to script applications and screen scrape the output for example, by accessing the
<code>terminal</code> from this class.</p>

                        <a href="Classes/HeadlessTerminal.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">HeadlessTerminal</span> <span class="p">:</span> <span class="kt"><a href="Protocols/TerminalDelegate.html">TerminalDelegate</a></span><span class="p">,</span> <span class="kt"><a href="Protocols/LocalProcessDelegate.html">LocalProcessDelegate</a></span></code></pre>

                        </div>
                      </div>
                      <div class="slightly-smaller">
                        <a href="https://github.com/migueldeicaza/SwiftTerm/tree/master/Sources/SwiftTerm/HeadlessTerminal.swift#L15-L63">Show on GitHub</a>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:9SwiftTerm12LocalProcessC"></a>
                    <a name="//apple_ref/swift/Class/LocalProcess" class="dashAnchor"></a>
                    <a class="token" href="#/s:9SwiftTerm12LocalProcessC">LocalProcess</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>This class provides the capabilities to launch a local Unix process, and connect it to a <code><a href="Classes/Terminal.html">Terminal</a></code>
 class or subclass.</p>

<p>The <code>MacLocalTerminalView</code> is an example of this, it is a subclass of the
 <code>MacTerminalView</code> NSView, and it connects that view to the local system, providing a complete
 terminal emulator connected to running local commands.</p>

<p>When you create an instance of <code>LocalProcess</code>, you provide a delegate that is used to notify
 your application when data is received from the lcoal process, to request the desired window size
 that you would like to give to the child process, and when the process terminates.</p>

<p>Once you create this instance, you can start a child process by calling the <code>startProcess</code> method
 which will start the process.   You can then send data to this underlying process using the
 <code>send(data:)</code> method, and you will receive the output on the provided delegate with the
 <code>dataReceived(slice:)</code> method.</p>

<p>Received data is dispatched via the queue that you provide in the LocalProcess constructor, if none
 is provided, this will default to <code>DispatchQueue.main</code>.  Generally, this is a good default, but if you
 have your own main loop or a different dispatching system, you will need to pass your own (for example,
 the <code><a href="Classes/HeadlessTerminal.html">HeadlessTerminal</a></code> implementation in the test suite does this.</p>

                        <a href="Classes/LocalProcess.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">LocalProcess</span></code></pre>

                        </div>
                      </div>
                      <div class="slightly-smaller">
                        <a href="https://github.com/migueldeicaza/SwiftTerm/tree/master/Sources/SwiftTerm/LocalProcess.swift#L48-L215">Show on GitHub</a>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/c:@M@SwiftTerm@objc(cs)TerminalDebugView"></a>
                    <a name="//apple_ref/swift/Class/TerminalDebugView" class="dashAnchor"></a>
                    <a class="token" href="#/c:@M@SwiftTerm@objc(cs)TerminalDebugView">TerminalDebugView</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Undocumented</p>

                        <a href="Classes/TerminalDebugView.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">TerminalDebugView</span> <span class="p">:</span> <span class="kt">NSView</span></code></pre>

                        </div>
                      </div>
                      <div class="slightly-smaller">
                        <a href="https://github.com/migueldeicaza/SwiftTerm/tree/master/Sources/SwiftTerm/Mac/MacDebugView.swift#L11-L126">Show on GitHub</a>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/c:@M@SwiftTerm@objc(cs)LocalProcessTerminalView"></a>
                    <a name="//apple_ref/swift/Class/LocalProcessTerminalView" class="dashAnchor"></a>
                    <a class="token" href="#/c:@M@SwiftTerm@objc(cs)LocalProcessTerminalView">LocalProcessTerminalView</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p><code>LocalProcessTerminalView</code> is an AppKit NSView that can be used to host a local process
 the process is launched inside a pseudo-terminal.</p>

<p>Call the <code>startProcess</code> to launch the underlying process inside a pseudo terminal.</p>

<p>Generally, for the <code>LocalProcessTerminalView</code> to be useful, you will want to disable the sandbox
 for your application, otherwise the underlying shell will not have access to much - not the majority of
 commands, not assorted places on the file systems and so on.   For this, you need to disable for your
 target in &ldquo;Signing and Capabilities&rdquo; the sandbox entirely.</p>

<p>Note: instances of <code>LocalProcessTerminalView</code> will set the <code><a href="Classes/TerminalView.html">TerminalView</a></code>&lsquo;s <code>delegate</code>
 property and capture and consume the messages.   The messages that are most likely needed for
 consumer applications are reposted to the <code><a href="Protocols/LocalProcessTerminalViewDelegate.html">LocalProcessTerminalViewDelegate</a></code> in
 <code>processDelegate</code>.   If you override the <code>delegate</code> directly, you might inadvertently break
 the internal working of <code>LocalProcessTerminalView</code>.   If you must change the <code>delegate</code>
 make sure that you proxy the values in your implementation to the values set after initializing this instance</p>

                        <a href="Classes/LocalProcessTerminalView.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">LocalProcessTerminalView</span> <span class="p">:</span> <span class="kt"><a href="Classes/TerminalView.html">TerminalView</a></span><span class="p">,</span> <span class="kt"><a href="Protocols/TerminalViewDelegate.html">TerminalViewDelegate</a></span><span class="p">,</span> <span class="kt"><a href="Protocols/LocalProcessDelegate.html">LocalProcessDelegate</a></span></code></pre>

                        </div>
                      </div>
                      <div class="slightly-smaller">
                        <a href="https://github.com/migueldeicaza/SwiftTerm/tree/master/Sources/SwiftTerm/Mac/MacLocalTerminalView.swift#L54-L154">Show on GitHub</a>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:9SwiftTerm21PseudoTerminalHelpersC"></a>
                    <a name="//apple_ref/swift/Class/PseudoTerminalHelpers" class="dashAnchor"></a>
                    <a class="token" href="#/s:9SwiftTerm21PseudoTerminalHelpersC">PseudoTerminalHelpers</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>APIs to assist in controlling a Unix pseudo-terminal from Swift, it provides a wrapper for
the libc <code>forkpty</code>API in the form of <code>fork(andExec:args:env:desiredWindowSize:</code> method,
<code>setWinSize</code> and <code>availableBytes</code></p>

                        <a href="Classes/PseudoTerminalHelpers.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">PseudoTerminalHelpers</span></code></pre>

                        </div>
                      </div>
                      <div class="slightly-smaller">
                        <a href="https://github.com/migueldeicaza/SwiftTerm/tree/master/Sources/SwiftTerm/Pty.swift#L16-L101">Show on GitHub</a>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:9SwiftTerm8TerminalC"></a>
                    <a name="//apple_ref/swift/Class/Terminal" class="dashAnchor"></a>
                    <a class="token" href="#/s:9SwiftTerm8TerminalC">Terminal</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>The <code>Terminal</code> class provides the terminal emulation engine, and can be used to feed data to the
 terminal emulator.   Typically users will intereact with a higher-level implementation that provides a
 UI toolkit-specific rendering and connects the input to the UI toolkit.</p>

<p>A front-end would draw the contents of the terminal, and take input from the user, which is in turn
 either mapped to one of the public APIs here, or if it is user input is passed to the <code>feed</code>  methods here.</p>

<p>The terminal is also connected to a backend that is conneted to the client, and data from this
 client is fed into the emulator by calling the <code>sendResponse method</code></p>

<p>The behavior of the terminal is configured by implementing the <code><a href="Protocols/TerminalDelegate.html">TerminalDelegate</a></code> protocol
 that is provided in the constructor call.</p>

                        <a href="Classes/Terminal.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">open</span> <span class="kd">class</span> <span class="kt">Terminal</span></code></pre>

                        </div>
                      </div>
                      <div class="slightly-smaller">
                        <a href="https://github.com/migueldeicaza/SwiftTerm/tree/master/Sources/SwiftTerm/Terminal.swift#L176-L4237">Show on GitHub</a>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/"></a>
                    <a name="//apple_ref/swift/Class/TerminalAccessory" class="dashAnchor"></a>
                    <a class="token" href="#/">TerminalAccessory</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>This class provides an input accessory for the terminal on iOS, you can access this via the <code>inputAccessoryView</code>
 property in the <code><a href="Classes/TerminalView.html">TerminalView</a></code> and casting the result to <code>TerminalAccessory</code>.</p>

<p>This class surfaces some state that the terminal might want to poke at, you should at least support the following
 properties;
 <code>controlModifer</code> should be set if the control key is pressed</p>

                        <a href="Classes/TerminalAccessory.html" class="slightly-smaller">See more</a>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/"></a>
                    <a name="//apple_ref/swift/Class/TerminalView" class="dashAnchor"></a>
                    <a class="token" href="#/">TerminalView</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>TerminalView provides an UIKit front-end to the <code><a href="Classes/Terminal.html">Terminal</a></code> termininal emulator.
 It is up to a subclass to either wire the terminal emulator to a remote terminal
 via some socket, to an application that wants to run with terminal emulation, or
 wiring this up to a pseudo-terminal.</p>

<p>Users are notified of interesting events in their implementation of the <code><a href="Protocols/TerminalViewDelegate.html">TerminalViewDelegate</a></code>
 methods - an instance must be provided to the constructor of <code>TerminalView</code>.</p>

<p>Call the <code>getTerminal</code> method to get a reference to the underlying <code><a href="Classes/Terminal.html">Terminal</a></code> that backs this
 view.</p>

<p>Use the <code>configureNativeColors()</code> to set the defaults colors for the view to match the OS
 defaults, otherwise, this uses its own set of defaults colors.</p>

                        <a href="Classes/TerminalView.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          
                        </div>
                      </div>
                    </section>
                  </div>
                </li>
              </ul>
            </div>
          </section>
        </section>
        <section id="footer">
          <p>&copy; 2020 <a class="link" href="https://tirania.org/" target="_blank" rel="external">Miguel de Icaza</a>. All rights reserved. (Last updated: 2020-05-30)</p>
          <p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.2</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
        </section>
      </article>
    </div>
  </body>
</div>
</html>
